package com.hbfec.mqttmanager.controller;

import com.hbfec.mqttmanager.entity.UserEntity;
import com.hbfec.mqttmanager.service.ChatLogService;
import com.hbfec.mqttmanager.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/chatlog")
public class ChatLogController {

    @Autowired
    private ChatLogService chatLogService;
    @Autowired
    private UserService userService;

    @RequestMapping("/{user}")
    public List<String> getAll(@PathVariable("user")String user)
    {
        return chatLogService.getAll(user);
    }
    @RequestMapping("/users")
    public List<UserEntity> getAllUser()
    {
        return userService.getAll();
    }

}
